home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 777 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. From: clamage@Eng.Sun.COM (Steve Clamage)
  2. Message-ID: <4iktec$btv@engnews1.Eng.Sun.COM>
  3. X-Original-Date: 19 Mar 1996 00:00:12 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 19 Mar 96 04:53:49 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Forward declaration of class member functi
  9. Organization: Sun Microsystems Inc.
  10. References: <UPMAIL07.199603182248040068@msn.com>
  11. Reply-To: clamage@Eng.Sun.COM
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMU495OEDnX0m9pzZAQFkvAF+NpLTaPMXHjB6ei2cvjMKcRpEKL73GTR5
  14.     xvQDaZtemJbGux4y3bbWToZmyKgWLcic
  15.     =TKWt
  16.  
  17. In article 199603182248040068@msn.com, "Ron Burk" <RonBurk@msn.com> writes:
  18. >I am having difficulty finding language in the draft
  19. >that establishes the legality or illegality of the following:
  20. >
  21. >class Forward;
  22. >
  23. >class Any {
  24. >    friend int Forward::SomeFunc(int SomeArg);
  25. >    };
  26.  
  27. It is not valid. You cannot mention the name of a class member until the
  28. class definition has been seen. To interpret the qualified-id A::B, the name
  29. B must be looked up in the scope of A. If A has not been defined, the lookup
  30. fails, and A::B must be considered undefined. Refer to chapters 3, 9, and 10
  31. of the draft standard.
  32.  
  33. If this sort of thing were allowed, you could add members to a class
  34. without modifying the class definition, thus violating the One-Definition
  35. Rule.
  36.  
  37. ---
  38. Steve Clamage, stephen.clamage@eng.sun.com
  39. ---
  40. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  41. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  42. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  43. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  44. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  45.